package org.lboot.idmo.converter;

import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import javax.persistence.AttributeConverter;
import javax.persistence.Converter;

/**
 * @author kindear
 * password 加密解密
 */
@Slf4j
@Component
@Converter
public class EncryptConverter implements AttributeConverter<String,String> {
    @Resource
    CustomEncryptConverter customEncryptConverter;

    @Override
    @SneakyThrows
    public String convertToDatabaseColumn(String s) {
       return customEncryptConverter.convertToDatabaseColumn(s);
    }

    @Override
    @SneakyThrows
    public String convertToEntityAttribute(String s) {
        return customEncryptConverter.convertToEntityAttribute(s);
    }

}
